﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition">
    
    
    <Style x:Key="FactoryWindow" TargetType="{x:Type Window}">
        <Setter Property="WindowStyle" Value="None"/>        
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="BorderBrush" Value="{StaticResource WindowTitleBarBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource WindowTitleBarForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource BigFontSize}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate  TargetType="{x:Type Window}">

                    <Border x:Name="border" BorderBrush="Black" BorderThickness="1">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border x:Name="PART_TitleBar"                                   
                                    CornerRadius="5,5,0,0"
                                    Background="{TemplateBinding BorderBrush}"
                                    Panel.ZIndex="100"
                                    Padding="3"                                    
                                    SF_Comp:CommandBehavior.RoutedEventName="MouseLeftButtonDown"
                                    SF_Comp:CommandBehavior.TheCommandToRun="{Binding MoveWindowCommand}">                                
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock
                                        Grid.Column="0"
                                        Padding="0,1,0,2"
                                        Foreground="{TemplateBinding Foreground}"                                        
                                        FontSize="{TemplateBinding FontSize}"
                                        Text="{TemplateBinding Title}"/>
                                    <StackPanel                                        
                                        Grid.Column="1"
                                        Margin="0,2,5,0"
                                        Orientation="Horizontal">
                                        <Button Style="{StaticResource MinimizeButton}" Command="{Binding MinimizeWindowCommand}" />
                                        <Button Style="{StaticResource MaximizeButton}" Command="{Binding MaximizeWindowCommand}" />
                                        <Button Style="{StaticResource CloseButton}" Command="{Binding CloseWindowCommand}"/>                                        
                                    </StackPanel>
                                </Grid>
                            </Border>


                            <Border Grid.Row="1" Background="White">
                                <ContentPresenter                                                        
                        Content="{TemplateBinding Content}"
                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                            </Border>
                        </Grid>                        
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter TargetName="border" Property="Border.CornerRadius" Value="0,0,0,0"/>
                            <Setter TargetName="PART_TitleBar" Property="Border.CornerRadius" Value="0,0,0,0"/>
                            <Setter TargetName="border" Property="Border.Margin" Value="{Binding Source={x:Static Application.Current}, Path=SystemBorderThickness}"/>                            
                            <Setter TargetName="border" Property="Border.Effect" Value="{x:Null}"/>
                        </Trigger>
                        <Trigger Property="WindowState" Value="Normal">
                            <Setter TargetName="border" Property="Border.CornerRadius" Value="5,5,0,0"/>
                            <Setter TargetName="PART_TitleBar" Property="Border.CornerRadius" Value="5,5,0,0"/>
                            <Setter TargetName="border" Property="Border.Margin" Value="0,0,10,10"/>
                            <Setter TargetName="border" Property="Border.Effect">
                                <Setter.Value>
                                    <DropShadowEffect Opacity="0.4" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FactoryMainWindow" TargetType="{x:Type Window}">
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="AllowsTransparency" Value="False"/>
        <Setter Property="BorderBrush" Value="{StaticResource WindowTitleBarBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource WindowTitleBarForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource BigFontSize}"/>
        <Setter Property="Background" Value="{StaticResource ApplicationBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate  TargetType="{x:Type Window}">

                    <Border x:Name="border" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}">
                        <ContentPresenter                                                        
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Border>
                   
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>